package net.alan.modules.repository;

import net.alan.modules.bean.Notice;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

/**
 * Author 李岩飞
 * Email eliyanfei@126.com
 * 2017/11/22
 */
public interface NoticeRepository extends JpaRepository<Notice, Integer> {
    /**
     * 通过用户Id获取通知信息
     *
     * @param userId
     * @param pageable
     * @return
     */
    Page<Notice> findByUserId(Integer userId, Pageable pageable);

    /**
     * 获取是否有未读的通知
     *
     * @return
     */
    int countByUserIdAndReadedFalse(Integer userId);
}
